Skip to content

fix: isGroupHandle incorrectly returns false for group chats#42

Merged
steipete merged 2 commits intosteipete:mainfrom
shivshil:fix/is-group-handle-detection
Feb 16, 2026
Merged

fix: isGroupHandle incorrectly returns false for group chats#42
steipete merged 2 commits intosteipete:mainfrom
shivshil:fix/is-group-handle-detection

Conversation

@shivshil
Copy link

@shivshil shivshil commented Feb 6, 2026

Problem

isGroupHandle(identifier:guid:) in RPCPayloads.swift always returns false for group chats in RPC output (is_group field).

The function prefers identifier over guid:

let handle = identifier.isEmpty ? guid : identifier
return handle.contains(";+;") || handle.contains(";-;")

For group chats:

  • identifier = bare GUID (e.g., 70012e07fc544289a74e87ecaf2ebe93) — no prefix
  • guid = prefixed (e.g., any;+;70012e07fc544289a74e87ecaf2ebe93) — has ;+;

Since ChatInfo always populates identifier, it's never empty, so guid is never checked. The bare GUID doesn't contain ;+;, so the function returns false.

Additionally, the ;-; check is incorrect — that prefix indicates DMs (any;-;+14155551212), not groups.

Fix

func isGroupHandle(identifier: String, guid: String) -> Bool {
  return guid.contains(";+;") || identifier.contains(";+;")
}

Always check guid (which carries the prefix), also check identifier as a fallback, and only match the group prefix ;+;.

Verification

Tested with imsg rpc --json on macOS 15.x:

Before fix:

  • Group chat 26: "is_group": false
  • DM chat 3: "is_group": false

After fix:

  • Group chat 26: "is_group": true
  • DM chat 3: "is_group": false

This affects both chats.list and message notification payloads in the RPC server. The CLI watch and history commands (which use MessagePayload / OutputModels.swift) are unaffected since they don't emit is_group.

safetynotgauranteed and others added 2 commits February 16, 2026 04:49
The previous implementation preferred `identifier` over `guid` when
checking for group chat prefixes. For group chats, `identifier` contains
the bare GUID (e.g. `70012e07fc54...`) which never has the `;+;` prefix,
while `guid` contains the prefixed form (e.g. `any;+;70012e07fc54...`).

Since `identifier` is never empty (ChatInfo always populates it), the
`guid` field was never checked, causing `is_group` to always return
`false` for group chats in RPC output.

Also removed the `;-;` check since that prefix indicates DMs, not groups.

Fix: always check both `guid` and `identifier` for the `;+;` group prefix.
@steipete steipete force-pushed the fix/is-group-handle-detection branch from 3c19d33 to bb23958 Compare February 16, 2026 03:50
@steipete steipete merged commit 3406429 into steipete:main Feb 16, 2026
1 check passed
@steipete
Copy link
Owner

Landed via temp rebase onto main.

  • Gate: make lint && make test && make build
  • Land commit: bb23958
  • Merge commit: 3406429

Thanks @shivshil!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants